﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BaseDatos;

namespace SCHD
{
    public partial class WFPerfil_Edit : TDV.Controles.Base.WinForm.BaseForm_Tipo01
    {
        public WFPerfil_Edit()
        {
            InitializeComponent();
        }
        private string Codigo = "";
        private string Descripcion = "";
        public WFPerfil_Edit(string codigo,string descripcion)
            :this()
        {
            this.Codigo = codigo;
            this.Descripcion = descripcion;
        }

        private void BtnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
            string usr = Environment.UserName.ToUpper();
            string wks = Environment.MachineName.ToUpper();
            string SQL = " update chdperfil set dscperf  = '"+TxtDescripcion.Text+"', usrmod = '"+usr+"',wksmod = '"+wks+"',fchmod = sysdate "+
                         " where codperf = '"+TxtCodigo.Text+"' and flgeli ='0'";
            ConexionBaseDatos.Conexion.EjecutarComando(SQL, CommandType.Text);
            DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void BtnCancelar_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }

        private void WFPerfil_Edit_Load(object sender, EventArgs e)
        {
            TxtCodigo.Text = Codigo;
            TxtDescripcion.Text = Descripcion;
            TxtCodigo.Enabled = false;
        }
    }
}
